package com.cuitrip.business.share.ui;

import android.view.View;
import android.widget.TextView;

import com.cuitrip.business.share.ShareChannelBuilder;
import com.cuitrip.business.tripservice.ui.IconTextView;
import com.cuitrip.service.R;
import com.cuitrip.util.ResourceUtil;
import com.lab.component.list.viewholder.CTRecycleViewHolder;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by ak on 15/11/24.
 */
public class ShareItemView extends CTRecycleViewHolder<ShareChannelBuilder.TripShareChannel> {

    @Bind(R.id.share_item_logo)
    IconTextView itemLogo;
    @Bind(R.id.share_item_text)
    TextView itemText;
    @Bind(R.id.item_layout)
    View itemLayout;
    @Bind(R.id.section_line)
    View sectionLine;

    public ShareItemView(View itemView) {
        super(itemView);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void render(ShareChannelBuilder.TripShareChannel share, int position) {
        if (ShareChannelBuilder.TripShareChannel.WECHAT.ordinal() == share.ordinal()) {
            itemText.setText(R.string.share_wechat);
            itemLogo.setText(R.string.wechat_icon);
            itemLayout.setBackgroundResource(R.drawable.shape_rect_apple_soild_4dp);
            sectionLine.setVisibility(View.VISIBLE);
        } else if (ShareChannelBuilder.TripShareChannel.MOMMENTS.ordinal() == share.ordinal()) {
            itemText.setText(R.string.share_moments);
            itemLogo.setText(R.string.momments_icon);
            itemLayout.setBackgroundResource(R.drawable.shape_rect_apple_soild_4dp);
            sectionLine.setVisibility(View.VISIBLE);
        } else if (ShareChannelBuilder.TripShareChannel.WEIBO.ordinal() == share.ordinal()) {
            itemText.setText(R.string.share_sina);
            itemLogo.setText(R.string.weibo_icon);
            itemLayout.setBackgroundResource(R.drawable.shape_rect_red_soild_4dp);
            sectionLine.setVisibility(View.VISIBLE);
        } else if (ShareChannelBuilder.TripShareChannel.QQ.ordinal() == share.ordinal()) {
            itemText.setText(R.string.share_qq);
            itemLogo.setText(R.string.qq_icon);
            itemLayout.setBackgroundResource(R.drawable.shape_rect_light_blue_soild_4dp);
            sectionLine.setVisibility(View.VISIBLE);
        } else if (ShareChannelBuilder.TripShareChannel.QQZONE.ordinal() == share.ordinal()) {
            itemText.setText(R.string.share_qzone);
            itemLogo.setText(R.string.qzone_icon);
            itemLayout.setBackgroundResource(R.drawable.shape_rect_mango_soild_4dp);
            sectionLine.setVisibility(View.VISIBLE);
        } else if (ShareChannelBuilder.TripShareChannel.MAIL.ordinal() == share.ordinal()) {
            itemText.setText(R.string.mail);
            itemLayout.setBackgroundResource(R.drawable.shape_white_corner_transparent_soild_4dp);
            sectionLine.setVisibility(View.INVISIBLE);
        } else if (ShareChannelBuilder.TripShareChannel.FACEBOOK.ordinal() == share.ordinal()) {
            itemText.setText(R.string.share_facebook);
            itemLogo.setText(R.string.facebook_icon);
            itemLayout.setBackgroundResource(R.drawable.shape_rect_facebook_blue_soild_4dp);
            sectionLine.setVisibility(View.VISIBLE);
        } else if (ShareChannelBuilder.TripShareChannel.MESSENGER.ordinal() == share.ordinal()) {
            itemText.setText(R.string.share_messenger);
            itemLogo.setText(R.string.messenger_icon);
            itemLayout.setBackgroundResource(R.drawable.shape_rect_messenger_blue_soild_4dp);
            sectionLine.setVisibility(View.VISIBLE);
        } else if (ShareChannelBuilder.TripShareChannel.TWITTER.ordinal() == share.ordinal()) {

        } else if (ShareChannelBuilder.TripShareChannel.COPY.ordinal() == share.ordinal()) {
            itemText.setText(R.string.share_copy);
            sectionLine.setVisibility(View.INVISIBLE);
        } else if (ShareChannelBuilder.TripShareChannel.TITLE.ordinal() == share.ordinal()) {
            itemText.setText(ResourceUtil.getString(R.string.share));
            sectionLine.setVisibility(View.INVISIBLE);
            itemLayout.setBackgroundResource(R.color.transparent);
        } else if (ShareChannelBuilder.TripShareChannel.More.ordinal() == share.ordinal()) {
            itemText.setText(ResourceUtil.getString(R.string.operation_more));
            sectionLine.setVisibility(View.INVISIBLE);
        }
    }



}

